package cn.java.Concurrency;

import java.util.concurrent.*;

/**
 * @author 小石潭记
 * @date 2021/12/19 10:34
 * @Description: ${todo}
 */
public class Test1 {
    public static void main(String[] args) throws InterruptedException {
        MyCallable1 myCallable1 = new MyCallable1();
        ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3,
                5L, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
        Future<String> future = executor.submit(myCallable1);
        Thread.sleep(4000);
        System.out.println(future.cancel(true) + " "
        + future.isCancelled());
    }

}
